using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;

public class AppDbContext : DbContext
{
    public DbSet<Student> Products { get; set; }

    protected override void OnConfiguring(DbContextOptionsBuilder options)
    {
        var config = new ConfigurationBuilder()
            .SetBasePath(Directory.GetCurrentDirectory())
            .AddJsonFile("appsettings.json")
            .Build();
        
        options.UseMySql(
            config.GetConnectionString("MySQL"),
            new MySqlServerVersion(ServerVersion.AutoDetect(config.GetConnectionString("MySQL")))
        );
    }
}

